#coding=utf-8
#!/usr/bin/env python
import urllib2
from xml.dom import minidom
def getRSS(addr):
    xmldoc = minidom.parseString(urllib2.urlopen(addr).read())
    items = xmldoc.getElementsByTagName('item')
    return items

def getLatestItems(items, num):
    latest=[]
    inxs = ['title','pubDate','link','description']
    myitems = [item for index, item in enumerate(items) if index < num]
    for  item in myitems:
        print item.toxml().encode('utf8')
        latest.append(dict(zip(inxs,[item.getElementsByTagName(inx)[0].firstChild.data for inx in inxs])))
        #print item.getElementsByTagName('title')[0].firstChild.data.encode("utf-8");
        #print item.getElementsByTagName('link')[0].firstChild.data.encode("utf-8");
        #print item.getElementsByTagName('pubDate')[0].firstChild.data.encode("utf-8");        
        #print item.toxml().encode("utf-8");><pubDate
      ##latest.append(dict(zip(inxsut,[item.getElementsByTagName(inx)[0].firstChild.data for inx in inxs])))
      
    return latest


if __name__=="__main__":
    #items =  getRSS("http://www.blogjava.net/wiflish/category/11012.html/rss");
    #latestItems = getLatestItems(items,4);
    #for item in latestItems:
    #    print item['description'].encode('utf-8');
    #items =  getRSS("http://feeds.delicious.com/v2/rss/OracleTechnologyNetwork/otntecharticle");
    #getLatestItems(items,1);
    
    print zip('abc',range(3));